import seckillApi from "@/api/declaration/mall/seckillApi"
import httpRequest from "@/config/axios/httpRequest"
import { SeckillActivityModel } from "@/models/mall/SeckillActivityModel"

// 查询秒杀活动列表
export const getSeckillActivityPage = async (params) => {
  return await httpRequest.get(seckillApi.GetSeckillActivityPage, { params })
}

// 查询秒杀活动列表，基于活动编号数组
export const getSeckillActivityListByIds = (ids: number[]) => {
  return httpRequest.get(seckillApi.GetSeckillActivityListByIds, { params: { ids } })
}

// 查询秒杀活动详情
export const getSeckillActivity = async (id: number) => {
  return await httpRequest.get(seckillApi.GetSeckillActivity, { params: { id } })
}

// 新增秒杀活动
export const createSeckillActivity = async (data: SeckillActivityModel) => {
  return await httpRequest.post(seckillApi.CreateSeckillActivity, data)
}

// 修改秒杀活动
export const updateSeckillActivity = async (data: SeckillActivityModel) => {
  return await httpRequest.put(seckillApi.UpdateSeckillActivity, data)
}

// 关闭秒杀活动
export const closeSeckillActivity = async (id: number) => {
  return await httpRequest.put(seckillApi.CloseSeckillActivity, { id })
}

// 删除秒杀活动
export const deleteSeckillActivity = async (id: number) => {
  return await httpRequest.delete(seckillApi.DeleteSeckillActivity, { params: { id } })
}
